
#include "../../Command.h"

#include "../../engine.h"

#include "../../User.h"

#include "../../NLogic/Static.h"


namespace ProjectZ { namespace NCommand {


void Command::CS_PK_END(User * pUser, ::Network::Packet * pPacket)
{
	STRESSLOG("%s", __FUNCTION__);

	PREPARE_PACKET;

	NLogic::Space * pSpace = pUser->GetSpace();
	if( NULL == pSpace )
	{
		NLogic::NFunction::SendExceptionNoSpace(pUser);
		DEBUGLOG("%s %d userseq[%d] Space is NULL", __FUNCTION__, __LINE__, pUser->GetUserSeq());
		return;
	}

	NLogic::Party * pParty = pUser->GetParty();
	if( NULL == pParty )
	{
		NLogic::NFunction::SendExceptionNoParty(pUser);
		DEBUGLOG("%s %d userseq[%d] party is null", __FUNCTION__, __LINE__, pUser->GetUserSeq());
		return;
	}

	pParty->SetState(NLogic::Party::State::PK_END);

	::Network::Packet * pNoti = ::Network::GETPACKETPOOL()->SEND_NEW();
	pNoti->MakePacket(CMD_SN_PK_END);


	pSpace->SendAll(pNoti);
}


} /*NCommand*/ }/*ProjectZ*/
